package com.bigShen.jdbc.basic;

/**
 * @Author eddy.shen
 * @Date 2018/11/17 10:38
 **/
public class JdbcDesc {

    public static void main(String[] args) {

        /**
         *
         * 使用JDBC连接数据库的步骤
         *
         * 1. 注册驱动
         *  　装载MySql驱动：Class.forName("com.mysql.jdbc.Driver");
         * 　 装载Oracle驱动：Class.forName("oracle.jdbc.driver.OracleDriver");
         * 2. 建立连接
         *    　连接MySql数据库：Connection conn = DriverManager.getConnection("jdbc:mysql://host:port/database", "user", "password");
         * 　　 连接Oracle数据库：Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@host:port:database", "user", "password");
         * 　　 连接SqlServer数据库：Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://host:port; DatabaseName=database", "user", "password");
         * 3. 创建statement
         *        Statement(简单的sql查询,不带查询参数) : conn.createStatement();
         *        PreparedStatement(复杂的sql查询,支持参数查询,并且防止了sql注入) : conn.prepareStatement();
         *        CallableStatement(调用存储过程的sql查询) : conn.prepareCall();
         * 4. 结果集ResultSet映射
         *        ResultSet rs = preparedStatement.executeQuery();
         *        String value = rs.getString("columnName")
         */

    }

}
